package cn.initcap.designpattern.pattern.creational.abstractfactory;

/**
 * 抽象工厂模式
 * 产品族与产品等级概念
 *
 * @author initcap
 * @date 2018/8/28 AM9:04
 */
public class Test {

    public static void main(String[] args) {
        // 扩展只需要增加工厂
        run(new JavaCourseFactory());

        run(new PythonCourseFactory());
    }

    /**
     * 业务逻辑不用变更
     *
     * @param courseFactory
     */
    private static void run(CourseFactory courseFactory) {
        AbstractVideo video = courseFactory.getVideo();
        AbstractArticle article = courseFactory.getArticle();
        video.produce();
        article.produce();
    }
}
